package com.second.market.controller;

import com.second.common.pojo.RR;
import com.second.market.pojo.entity.TbCustomerIssues;
import com.second.market.pojo.entity.TbCustomerPlace;
import com.second.market.pojo.vo.CustomerPlaceVo;
import com.second.market.pojo.vo.CustomerVo;
import com.second.market.service.CustomerPlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: clms-second
 * @description: 位置管理的控制类
 * @author: 邓衡
 * @create: 2021-07-24 18:38
 **/
@RestController
@RequestMapping("market/place")
public class CustomerPlaceController {

    @Autowired
    private CustomerPlaceService customerPlaceService;

    //初始化查询
    @PostMapping("initPlaceTable/{currentPage}/{pageSize}")
    public RR initPlaceTable(@PathVariable("currentPage") Integer currentPage,
                                @PathVariable("pageSize") Integer pageSize,
                                @RequestBody CustomerPlaceVo customerPlaceVo
    ){
        return customerPlaceService.fincustomerPlaceByPage(currentPage,pageSize,customerPlaceVo);

    }

    //添加
    @PostMapping("insert")
    public RR insert(@RequestBody TbCustomerPlace tbCustomerPlace) {
        return customerPlaceService.insert(tbCustomerPlace);
    }

    //修改
    @PutMapping("update")
    public RR update(@RequestBody TbCustomerPlace tbCustomerPlace){
        return customerPlaceService.update(tbCustomerPlace);
    }

    //回显查询
    @GetMapping("selectById/{id}")
    public RR selectById(@PathVariable Integer id){
        return customerPlaceService.selectById(id);
    }

    //删除
    @DeleteMapping
    public RR deleteById(@RequestParam Integer id){
        return customerPlaceService.delete(id);
    }



}
